<?php

/**
 * Billing form base class.
 *
 * @package    utility
 * @subpackage form
 * @author     Your name here
 */
class BaseBillingForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                => new sfWidgetFormInputHidden(),
      'station_id'        => new sfWidgetFormPropelChoice(array('model' => 'Station', 'add_empty' => true)),
      'building_id'       => new sfWidgetFormPropelChoice(array('model' => 'Building', 'add_empty' => true)),
      'occupant_id'       => new sfWidgetFormPropelChoice(array('model' => 'Occupant', 'add_empty' => true)),
      'meter_no'          => new sfWidgetFormInput(),
      'consumer_no'       => new sfWidgetFormInput(),
      'billing_date'      => new sfWidgetFormDate(),
      'previous_reading'  => new sfWidgetFormInput(),
      'present_reading'   => new sfWidgetFormInput(),
      'units_consumed'    => new sfWidgetFormInput(),
      'units_free'        => new sfWidgetFormInput(),
      'units_total'       => new sfWidgetFormInput(),
      'water_charges'     => new sfWidgetFormInput(),
      'tv_charges'        => new sfWidgetFormInput(),
      'split_charges'     => new sfWidgetFormInput(),
      'window_charges'    => new sfWidgetFormInput(),
      'gas_charges'       => new sfWidgetFormInput(),
      'misc_charges'      => new sfWidgetFormInput(),
      'furniture_charges' => new sfWidgetFormInput(),
      'meter_rent'        => new sfWidgetFormInput(),
      'grand_total'       => new sfWidgetFormInput(),
      'print_status'      => new sfWidgetFormInput(),
      'payment_status'    => new sfWidgetFormInput(),
      'bill_type'         => new sfWidgetFormInput(),
      'billing_category'  => new sfWidgetFormInput(),
      'status'            => new sfWidgetFormInput(),
      'created_at'        => new sfWidgetFormDate(),
      'updated_at'        => new sfWidgetFormDate(),
    ));

    $this->setValidators(array(
      'id'                => new sfValidatorPropelChoice(array('model' => 'Billing', 'column' => 'id', 'required' => false)),
      'station_id'        => new sfValidatorPropelChoice(array('model' => 'Station', 'column' => 'id', 'required' => false)),
      'building_id'       => new sfValidatorPropelChoice(array('model' => 'Building', 'column' => 'id', 'required' => false)),
      'occupant_id'       => new sfValidatorPropelChoice(array('model' => 'Occupant', 'column' => 'id', 'required' => false)),
      'meter_no'          => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'consumer_no'       => new sfValidatorString(array('max_length' => 50, 'required' => false)),
      'billing_date'      => new sfValidatorDate(array('required' => false)),
      'previous_reading'  => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'present_reading'   => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'units_consumed'    => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'units_free'        => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'units_total'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'water_charges'     => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'tv_charges'        => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'split_charges'     => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'window_charges'    => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'gas_charges'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'misc_charges'      => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'furniture_charges' => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'meter_rent'        => new sfValidatorString(array('max_length' => 5, 'required' => false)),
      'grand_total'       => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'print_status'      => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'payment_status'    => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'bill_type'         => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'billing_category'  => new sfValidatorString(array('max_length' => 25, 'required' => false)),
      'status'            => new sfValidatorString(array('max_length' => 10, 'required' => false)),
      'created_at'        => new sfValidatorDate(array('required' => false)),
      'updated_at'        => new sfValidatorDate(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('billing[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Billing';
  }


}
